﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FooFun.DataElements.Dtos
{
    public class IntDataElement : DataElement
    {
        public static implicit operator IntDataElement(int i)
        {
            return new IntDataElement(i);
        }

        int i;

        public IntDataElement(int i)
        {
            this.i = i;
        }

        #region IDataElement 成员

        public override object Value
        {
            get
            {
                return this.i;
            }
            set
            {
                this.i = (int)value;
            }
        }

        public override IDataElement this[string attrName]
        {
            get
            {
                return null;
            }
            set
            {
                throw new Exception("该存储位置无法保持数据");
            }
        }

        public override IDataElement Add(IDataElement de)
        {
            throw new Exception("该存储位置无法保持数据");
        }

        public override bool IsEmpty
        {
            get
            {
                return false;
            }
        }

        #endregion

        #region IEnumerable 成员

        public override System.Collections.IEnumerator GetEnumerator()
        {
            yield break;
        }

        #endregion
    }
}
